<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>getElementsByName&getElementsByClassName</title>
</head>
<body>
    <div class="example1" name="la">1</div>
    <div class="example2" name="la">1</div>
    <div class="example3" name="la">1</div>
    <div class="example2" >byClassName</div>
    <p>1</p>
<script>
    var byClassName = document.getElementsByClassName("example1")[0].innerHTML;
    console.log(byClassName);

    var byName = document.getElementsByName("la")[0].innerHTML;
    console.log(byName);

//    getElementById和getElementsByName 很相似，一个是根据id属性查找，一个是根据name属性查找。
//    而getElementsbyClassName则是根据class属性查询的
</script>
</body>
</html>